﻿<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="ManageDrivers.aspx.cs" Inherits="View_ManageDrivers" Title="Quản lý lái xe" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script type="text/javascript">
            function onRequestStart(sender, args) {
                if (args.get_eventTarget().indexOf("tbnExport") >= 0)
                    args.set_enableAjax(false);
            }
            //enter search
            function OnKeyPress(sender, eventArgs) {
                var c = eventArgs.get_keyCode();
                if (c == 13) {
                    var stringSearch = $("#<%= txtKeyWord.ClientID%>").val();
                    $("#<%= hdfSearchString.ClientID %>").val(stringSearch);
                    $("#<%=btnSearch.ClientID %>").click();
                    eventArgs.set_cancel(true);
                }
            }

            function messsage(mes) {
                alert(mes);
                return false;
            }


        </script>
    </telerik:RadScriptBlock>
    <link href="../Style/StyleCommon.css" rel="stylesheet" type="text/css" />
    <link href="../Style/StyleCommon.css" rel="stylesheet" />
    <script language="javascript" type="text/javascript" src="../Scripts/Common.js"> </script>
    <div class="tabHeader">
        <span class="iconHomeBox">
            <img src="../Content/system/user-group-icon.png" style="width: 30px; height: 30px; position: absolute" title="Quản lý lái xe" />
            <div class="tabHeaderText" style="padding-top: 5px; padding-left: 40px;">
                <asp:Label ID="Label1" runat="server" Text="Quản lý lái xe" />
            </div>
    </div>
    <div id="tab1" class="tabContent tabDetailContent">
        <telerik:RadAjaxPanel ID="rapCountry" runat="server" LoadingPanelID="loadingPanel"
            HorizontalAlign="NotSet">
            <asp:HiddenField runat="server" ID="hdfSearchString" />
            <div id="message">
            </div>
            <table style="width: 100%">
                <tr style="text-align: left">
                    <td>
                        <table>
                            <tr>
                                <td>
                                    <telerik:RadTextBox ID="txtKeyWord" Height="25px" runat="server" EmptyMessage="Nhập từ khóa tìm kiếm" LabelCssClass="" Width="200px">
                                        <ClientEvents OnKeyPress="OnKeyPress" />
                                    </telerik:RadTextBox>
                                </td>
                                <td>
                                    <asp:Button ID="btnSearch" runat="server" CssClass="myButton" Text="Tìm kiếm"
                                        OnClick="btnSearch_Click" />
                                </td>
                                <td>
                                   <asp:Button ID="tbnExport" Width="100px" runat="server"  CssClass="myButton" Text="Export excel"
                                        OnClick="tbnExport_Click" />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>

            <telerik:RadGrid ID="rdGDriver" MasterTableView-InsertItemPageIndexAction="ShowItemOnFirstPage" runat="server" AllowPaging="True" AutoGenerateColumns="False" GridLines="None" OnDeleteCommand="rdGDriver_DeleteCommand" OnInsertCommand="rdGDriver_InsertCommand" OnItemDataBound="rdGDriver_ItemDataBound" OnNeedDataSource="rdGDriver_NeedDataSource" OnUpdateCommand="rdGDriver_UpdateCommand" PageSize="5" Skin="Office2010Blue">
                <ClientSettings EnableRowHoverStyle="true">
                    <Selecting AllowRowSelect="true" />
                </ClientSettings>
                <MasterTableView AllowSorting="True" CommandItemDisplay="Top" DataKeyNames="ID">
                    <Columns>
                        <telerik:GridTemplateColumn DataField="STT" HeaderText="STT" UniqueName="STT">
                            <ItemTemplate>
                                <asp:Label ID="lblSTT" runat="server" Text='<%# Eval("STT") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="30px" />
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="FullName" EditFormHeaderTextFormat="Họ tên đầy đủ:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Họ tên đầy đủ" UniqueName="FullName">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtFullName" runat="server" Text='<%# Bind("FullName") %>' Width="300px"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblFullName" Font-Bold="false" runat="server" Text='<%# Eval("FullName") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="300px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="IDNumber" EditFormHeaderTextFormat="Số chứng minh thư:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Số chứng minh thư" UniqueName="IDNumber">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtIDNumber" runat="server" Text='<%# Bind("IDNumber") %>' Width="300px"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblIDNumber" runat="server" Text='<%# Eval("IDNumber") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="100px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="DateOfBirth" EditFormHeaderTextFormat="Ngày sinh:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Ngày sinh" UniqueName="DateOfBirth">
                            <EditItemTemplate>
                                <telerik:RadDatePicker Skin="Office2010Blue" Width="200px" ID="BirthDatePicker" runat="server" MinDate="1/1/1900" DbSelectedDate='<%# Bind("DateOfBirth") %>'
                                    TabIndex="4">
                                    <DateInput ID="DateInput1" runat="server" DateFormat="yyyy-MM-dd" DisplayDateFormat="dd/MM/yyyy">
                                    </DateInput>
                                </telerik:RadDatePicker>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblDateOfBirth" runat="server" Text='<%# Eval("DateOfBirth") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="100px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="RankDriver" EditFormHeaderTextFormat="Hạng bằng lái xe:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Hạng bằng lái xe" UniqueName="RankDriver">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtRankDriver" runat="server" Text='<%# Bind("RankDriver") %>' Width="300px"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblRankDriver" runat="server" Text='<%# Eval("RankDriver") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="50px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="Nationality" EditFormHeaderTextFormat="Quốc tịch:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Quốc tịch" UniqueName="Nationality">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtNationality" runat="server" Text='<%# Bind("Nationality") %>' Width="300px"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblNationality" runat="server" Text='<%# Eval("Nationality") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="150px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="TimeOut" EditFormHeaderTextFormat="Ngày hết hạn hợp đồng:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Ngày hết hạn hợp đồng" UniqueName="TimeOut">
                            <EditItemTemplate>
                                <telerik:RadDatePicker Skin="Office2010Blue" Width="200px" ID="TimeOut" runat="server" MinDate="1/1/1900" DbSelectedDate='<%# Bind("TimeOut") %>'
                                    TabIndex="4">
                                    <DateInput runat="server" DateFormat="yyyy-MM-dd" DisplayDateFormat="dd/MM/yyyy">
                                    </DateInput>
                                </telerik:RadDatePicker>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblTimeOut" runat="server" Text='<%# Eval("TimeOut") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="100px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="Residence" EditFormHeaderTextFormat="Địa chỉ thường trú:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Địa chỉ thường trú" UniqueName="Residence">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtResidence" runat="server" Text='<%# Bind("Residence") %>' Width="300px"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblResidence" runat="server" Text='<%# Eval("Residence") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="300px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="Phone" EditFormHeaderTextFormat="Số điện thoại:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Số điện thoại" UniqueName="Phone">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtPhone" runat="server" Text='<%# Bind("Phone") %>' Width="300px"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblPhone" runat="server" Text='<%# Eval("Phone") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="100px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="Email" EditFormHeaderTextFormat="Thư điện tử:" HeaderText="Thư điện tử" UniqueName="Email">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtEmail" runat="server" Text='<%# Bind("Email") %>' Width="300px"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblEmail" runat="server" Text='<%# Eval("Email") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="300px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="../Images/Grid/Skins/Telerik/Edit.gif" EditText="Chỉnh sửa" InsertImageUrl="../Images/Grid/Skins/Telerik/Insert.gif" ItemStyle-Height="20px" ItemStyle-Width="20px" UniqueName="Edit">
                            <ItemStyle CssClass="editcommand" />
                            <HeaderStyle Height="20px" HorizontalAlign="Left" Width="20px" />
                        </telerik:GridEditCommandColumn>
                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmText="Bạn có chắc chắn muốn xóa không?" ImageUrl="../Images/Grid/Skins/Telerik/Delete.gif" ItemStyle-Height="20px" ItemStyle-Width="20px" Text="Xóa" UniqueName="Delete">
                            <ItemStyle CssClass="editcommand" />
                            <HeaderStyle Height="20px" HorizontalAlign="Left" Width="20px" />
                        </telerik:GridButtonColumn>
                    </Columns>
                    <EditFormSettings CaptionDataField="STT" CaptionFormatString="Chỉnh sửa dữ liệu cho STT {0}">
                        <EditColumn ButtonType="PushButton" CancelText="Hủy bỏ" InsertText="Thêm mới" UniqueName="EditCommandColumn1" UpdateText="Cập nhật">
                        </EditColumn>
                    </EditFormSettings>
                    <PagerStyle AlwaysVisible="True" CssClass="GridPager_Telerik" Mode="NextPrevNumericAndAdvanced" NextPageText="Next" PagerTextFormat="{4}|Displaying page {0} / {1},items {2} to {3} of {5}" PrevPageText="Previous" VerticalAlign="Middle" />
                    <CommandItemTemplate>
                        <table style="border: 0; width: 100%">
                            <tr>
                                <td style="text-align: left">
                                    <asp:LinkButton ID="lkbtnAddOrganizationInv" runat="server" CommandName="InitInsert" Text="&lt;img style=&quot;border:0px&quot; alt=&quot;&quot; src=&quot;../Images/Grid/Skins/Telerik/AddRecord.gif&quot; /&gt; Thêm mới lái xe"></asp:LinkButton>
                                </td>
                            </tr>
                        </table>
                    </CommandItemTemplate>
                </MasterTableView>
            </telerik:RadGrid>
            <telerik:RadInputManager runat="server" ID="RadInputManager1">
                <telerik:TextBoxSetting EmptyMessage="Vui lòng nhập dữ liệu.." ErrorMessage="Vui lòng nhập dữ liệu..">
                    <TargetControls>
                        <telerik:TargetInput ControlID="txtFullName" />
                        <telerik:TargetInput ControlID="txtIDNumber" />
                        <telerik:TargetInput ControlID="txtRankDriver" />
                        <telerik:TargetInput ControlID="txtNationality" />
                        <telerik:TargetInput ControlID="txtResidence" />
                        <telerik:TargetInput ControlID="txtPhone" />
                    </TargetControls>
                    <Validation IsRequired="True" />
                </telerik:TextBoxSetting>
                <telerik:NumericTextBoxSetting BehaviorID="NumericBehavior1" EmptyMessage="Vui lòng nhập dữ liệu..."  ErrorMessage="Vui lòng nhập dữ liệu.." Type="Number" DecimalDigits="0"
                    MaxValue="99999999999" MinValue="0">
                    <TargetControls>
                        <telerik:TargetInput ControlID="txtIDNumber" />
                        <telerik:TargetInput ControlID="txtRankDriver" />
                        <telerik:TargetInput ControlID="txtPhone" />
                    </TargetControls>
                </telerik:NumericTextBoxSetting>
                <telerik:DateInputSetting></telerik:DateInputSetting>
            </telerik:RadInputManager>
        </telerik:RadAjaxPanel>

        <telerik:RadAjaxLoadingPanel ID="loadingPanel" runat="server" Transparency="30" BackColor="White"
            Width="967px">
            <asp:Image ID="Image1" runat="server" Style="margin-top: 150px" AlternateText="Loading"
                BorderWidth="0px" ImageUrl="../Images/ImageControl/loading.old.gif" />
        </telerik:RadAjaxLoadingPanel>
    </div>
</asp:Content>
